package com.hci.leukemiaapp;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class PillBoxActivity extends ListActivity {
	
	static final String[] PILLS = {"Cytoxan"};

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pills_list);
	    
	    ListView lv = getListView();
	    lv.setAdapter(new ArrayAdapter<String>(this, R.layout.notes_row, PILLS));
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        setContentView(R.layout.pill_info);
    }
    
    public void viewPills(View v) {
    	setContentView(R.layout.pills_list);
    	
    	ListView lv = getListView();
	    lv.setAdapter(new ArrayAdapter<String>(this, R.layout.notes_row, PILLS));
    }
    
    public void editPill(View v) {
    	Intent i = new Intent(this, PillEdit.class);
        startActivityForResult(i, 0);
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
        if(resultCode==RESULT_OK) {
        	Toast.makeText(this, 
                    "Changes Saved", 
                    Toast.LENGTH_SHORT).show();
        }
    }
}